// 根据数据渲染文章内容
<template>
  <div class="Content-content" v-if="info.title">
    <h1>{{ info.title }}</h1>
    <div class="abbr">
      <span>日期：{{ setStringDate(info.createDate) }}</span>
      <span>浏览量：{{ info.scanNumber }}</span>
      <span>
        <a href="#comment">评论：{{ info.commentNumber }}</a>
      </span>
      <span>
        <a :href="'/blog/cate/' + info.category.id">{{ info.category.name }}</a>
      </span>
    </div>
    <div class="markdown-body" v-html="info.htmlContent"></div>
  </div>
</template>

<script>
import setStringDate from "@/utils/setStringDate";
import "highlight.js/styles/github.css";
export default {
  props: {
    info: {
      type: Object,
    },
  },
  methods: {
    setStringDate,
  },
};
</script>

<style lang="less" scoped>
@import url(~@/style/var.less);
@import url(~@/style/markdown.css);
.Content-content {
  width: 100%;
  box-sizing: border-box;
  .abbr {
    color: @gray;
    span {
      margin: 5px;
      a {
        color: @gray;
        text-decoration: none;
        &:hover {
          color: red;
        }
      }
    }
  }
  .markdown-body {
    margin: 1em 0;
  }
}
</style>